﻿using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuanLyDiem.Controllers
{
    public class C_KyThu
    {
        public static void LoadDataSource(LookUpEdit lookUpEdit, Context db = null)
        {
            if (db == null) db = new Context();
              lookUpEdit.Properties.Columns.Clear();
            lookUpEdit.Properties.DataSource = db.ChuongTrinhDaoTaoChiTiets.Select(o => o.Ky_thu).Distinct().ToList();
     //      lookUpEdit.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Ky_thu", "Kỳ thứ"));
            lookUpEdit.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFit;
      //         lookUpEdit.Properties.DisplayMember = "Ky_thu";
      //         lookUpEdit.Properties.ValueMember = "Ky_thu";
            lookUpEdit.Properties.NullValuePromptShowForEmptyValue = true;
            lookUpEdit.Properties.AllowDropDownWhenReadOnly = DevExpress.Utils.DefaultBoolean.True;
            lookUpEdit.ItemIndex = 1;
        }
    }
}
